package math.vector;

import math.Maths;

public class vec2i 
{

    public int x;
    public int y;

    public vec2i() 
    {
        x = 0;
        y = 0;
    }
    
    public vec2i(int x_coord, int y_coord) 
    {
        x = x_coord;
        y = y_coord;
    }

    public vec2i(float x_coord, float y_coord) 
    {
        this(Maths.nearestInt(x_coord), Maths.nearestInt(y_coord));
    }
    
    public vec2i(double x_coord, double y_coord) 
    {
        this((float)x_coord, (float)y_coord);
    }

    public vec2i(vec2i vec) 
    {
        this(vec.x, vec.y);
    }
    
    public vec2i(vec2f vecf) 
    {
        this(vecf.x, vecf.y);
    }
    
    public void swapWith(vec2i vec) 
    {
        vec2i vt = new vec2i(vec);
        vec.setTo(this);
        this.setTo(vt);
    }
    
    public void setTo(int vx, int vy) 
    {
        x = vx;
        y = vy;
    }

    public void setTo(vec2i u) 
    {
        setTo(u.x, u.y);
    }
    
    public String toString() 
    {
        String s = "";
        s += "( " + x + ", " + y + " )";
        return s;
    }

}
